package com.itheima.reggie.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class BaseController {
    @Autowired
    protected HttpServletRequest request;

    /**
     * 注入响应对象
     */
    @Autowired
    protected HttpServletResponse response;

    /**
     * 注入会话对象
     */
    @Autowired
    protected HttpSession session;

    /**
     * 从会话中获取登录的id
     */
    public Long getLoginIdFromSession() {
        return (Long) session.getAttribute("LOGIN_ID");
    }
}
